//
//  LCYUserInfoManager.m
//  EPA
//
//  Created by lanou3g on 16/4/25.
//  Copyright © 2016年 liu. All rights reserved.
//

#import "LCYUserInfoManager.h"
#import "LCYLoginViewController.h"
@implementation LCYUserInfoManager

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
}


+ (instancetype)shareManager{
    static LCYUserInfoManager *manager = nil;
    @synchronized(self) {
        if (!manager) {
            manager = [[LCYUserInfoManager alloc]init];
        }
    }
    return manager;
}

- (void)loginWithUserDic:(NSDictionary *)dict{
    if (dict) {
        [self setValuesForKeysWithDictionary:dict];
    }
}

- (void)setValue:(id)value forKey:(NSString *)key {
    [super setValue:value forKey:key];
    // 存储到本地
    [[NSUserDefaults standardUserDefaults] setObject:value forKey:key];
    [[NSUserDefaults standardUserDefaults] synchronize];
}


+ (void)saveUserName:(NSString *)userName {
    [[NSUserDefaults standardUserDefaults] setObject:userName forKey:@"userName"];
    [[NSUserDefaults standardUserDefaults] synchronize];
}
+ (NSString *)userName {
    NSString *userName = [[NSUserDefaults standardUserDefaults] objectForKey:@"userName"];
    if (userName == nil) {
        return @"";
    }
    return userName;
}


@end
